//
//  DailyNew.swift
//  MyCookbook
//
//  Created by liaokylin on 2024/10/21.
//

import SwiftUI

struct DailyNew: View {
    var layout = [
        GridItem(.adaptive(minimum: 120, maximum: 240)),
        GridItem(.adaptive(minimum: 120, maximum: 240)),
        GridItem(.adaptive(minimum: 120, maximum: 240))
    ]
    var body: some View {
        VStack{
            HStack{
                Text("每日上新")
                    .font(.title)
                    .bold()
                Spacer()
                NavigationLink {
                    
                } label: {
                    Text("想要的商品")
                    .padding()
                    .font(.subheadline)
                    .bold()
                    .foregroundColor(.pink.opacity(0.8))
                    .background(Color.pink.opacity(0.1))
                    .cornerRadius(16)
                }

            }
            LazyVGrid(columns: layout) {
                ForEach(1...6,id:\.self) { _ in
                    VStack(alignment:.leading){
                        Image("1").resizable()
                            .cornerRadius(10)
                            .frame(maxWidth: .infinity,maxHeight: 120)
                        Text("这是很长的标题啊啊啊啊啊").truncationMode(.tail)
                            .font(.title3)
                            .lineLimit(1)
                        Text("$59.9")
                            .font(.caption)
                            .foregroundColor(.pink)
                    }

                }
            }
        }
    }
}

#Preview {
    DailyNew()
}
